﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:BaseConverters1="clr-namespace:Prometheus.Binding.ReadOnly.BaseConverters">
    <ControlTemplate x:Key="ValidationToolTipTemplate">
        <Grid x:Name="Root" Margin="5,0" RenderTransformOrigin="0,0" Opacity="0">
            <Grid.RenderTransform>
                <TranslateTransform x:Name="xform" X="-25"/>
            </Grid.RenderTransform>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup Name="OpenStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition GeneratedDuration="0"/>
                        <VisualTransition To="Open" GeneratedDuration="0:0:0.2">
                            <Storyboard>
                                <DoubleAnimation Storyboard.TargetName="xform"
                                                 Storyboard.TargetProperty="X"
                                                 To="0"
                                                 Duration="0:0:0.2">
                                   
                                </DoubleAnimation>
                                <DoubleAnimation Storyboard.TargetName="Root"
                                                 Storyboard.TargetProperty="Opacity"
                                                 To="1"
                                                 Duration="0:0:0.2"/>
                            </Storyboard>
                        </VisualTransition>
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Closed">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="Root"
                                             Storyboard.TargetProperty="Opacity"
                                             To="0"
                                             Duration="0"/>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Open">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="xform"
                                             Storyboard.TargetProperty="X"
                                             To="0"
                                             Duration="0"/>
                            <DoubleAnimation Storyboard.TargetName="Root"
                                             Storyboard.TargetProperty="Opacity"
                                             To="1"
                                             Duration="0"/>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            
            <Border CornerRadius="2">
                <Border.Background>
                    <Binding Path="Type" BindsDirectlyToSource="True" UpdateSourceTrigger="Default" Mode="OneWay">
                        <Binding.Converter>
                            <BaseConverters1:proX1IfTrue_X2IfFalseConverter X1="DarkOrange" X2="DarkRed">
                                <BaseConverters1:proInvertBooleanConverter>
                                    <BaseConverters1:proIsToStringEquals EqualsTo="Error"/>
                                </BaseConverters1:proInvertBooleanConverter>
                            </BaseConverters1:proX1IfTrue_X2IfFalseConverter>
                        </Binding.Converter>
                    </Binding>
                </Border.Background>
                <StackPanel Orientation="Horizontal" Margin="8,4,8,4">                    
                    <TextBlock 
                       UseLayoutRounding="false" 
                       Foreground="White"
                       VerticalAlignment="Center"
                       FontWeight="Bold"
                       MaxWidth="250"
                       TextWrapping="Wrap"
                       Text="{Binding Message}"/>

                </StackPanel>
            </Border>
            <!--<Grid.Effect>
                <DropShadowEffect ShadowDepth="1"/>
            </Grid.Effect>-->
        </Grid>
    </ControlTemplate>

</ResourceDictionary>
